<?php
$this->Html->addCrumb('Announcements', '/member/announcements');
$this->Html->addCrumb('Add');
?>
<?php 
$this->Html->scriptStart(array('inline' => false));
echo '
      $(function(){
        $("#AnnouncementMemberAddForm").TWS_Form( {
          validate : {
          rules : {
            AnnouncementTitle : {required : true, help : "This is the title for the announcement"},
            AnnouncementTeaser : {required : true, help : "This is the teaser text for the announcement"},
            AnnouncementBody : {help : "The main body of the announcement"},
            AnnouncementStartDate: {required : true, date:true, help : "The start date when the announcement will be effective"},
            AnnouncementEndDate: {required : true, date:true, help : "The end date of the announcement"},
            AnnouncementVisibility : {required : true, help :"Public: Visible on Main website<br/>Private: Visible for members only<br/>Hidden: Do not show this announcement"}
          }
          }});
        });
       ';
$this->Html->scriptEnd();
?>
<h1>Add Announcement</h1>

<?php echo '<div id="actionLink">'.$this->Html->link('Back to list of Announcements',array('action'=>'index', 'member'=>true)).'</div>'; ?>

<?php echo $this->element('errors', array('errors' => isset($errors)? $errors : null)); ?>
<?php

echo $this->TWSForm->create('Announcement',  array(
    'inputDefaults' => array(
        'div' => array('class'=>'row')),
        'class'=>'inlineForm',
        'type'=>'file'));

echo $this->TWSForm->input('title', array('name'=>'AnnouncementTitle', 'type'=>'text', 'label'=>'<span class="required">*</span>Title'));
echo $this->TWSForm->input('teaser', array('rows'=>'3','name'=>'AnnouncementTeaser', 'label'=>'<span class="required">*</span>Teaser'));
echo $this->TWSForm->input('body', array('rows' => '5','name'=>'AnnouncementBody'));
echo $this->TWSForm->input('start_date', array('type'=>'text', 'rel'=>'date','name'=>'AnnouncementStartDate', 'label'=>'<span class="required">*</span>Start Date'));
echo $this->TWSForm->input('end_date', array('type'=>'text', 'rel'=>'date','name'=>'AnnouncementEndDate', 'label'=>'<span class="required">*</span>End Date'));
echo $this->TWSForm->input('visibility', array('type'=>'select','options'=>$visibilityOptions,'name'=>'AnnouncementVisibility'));
echo $this->TWSForm->input('image_path_1', array('type'=>'file', 'label'=>'Upload image', 'name'=>'AnnouncementImagePath1'));
echo $this->TWSForm->end( array("label"=>"Add", "class"=>"button"));

/*
echo $this->TWSForm->input('title', array('type'=>'text'));
echo $this->TWSForm->input('teaser', array('rows'=>'3','name'=>'AnnouncementTeaser'));
echo $this->TWSForm->input('body', array('rows' => '5'));
echo $this->TWSForm->input('start_date', array('type'=>'text', 'rel'=>'date'));
echo $this->TWSForm->input('end_date', array('type'=>'text', 'rel'=>'date'));
echo $this->TWSForm->input('visibility', array('type'=>'select','options'=>array('P'=>'Public','R'=>'Private','H'=>'Hidden')));
echo $this->TWSForm->input('image_path_1', array('type'=>'file', 'label'=>'Upload image'));
echo $this->TWSForm->end("Add announcement");
*/

?>